home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Freeware 2002 November
/
SGI Freeware 2002 November - Disc 3.iso
/
dist
/
fw_qt3.idb
/
usr
/
freeware
/
Qt
/
examples
/
trayicon
/
main.cpp.z
/
main.cpp
Wrap
C/C++ Source or Header
|
2002-04-08
|
2KB
|
91 lines
static const char * const maximize_xpm[]={
"12 12 2 1",
"# c #000000",
". c None",
"............",
"............",
".##########.",
".##########.",
".#........#.",
".#........#.",
".#........#.",
".#........#.",
".#........#.",
".##########.",
"............",
"............"};
static const char * const minimize_xpm[] = {
"12 12 2 1",
"# c #000000",
". c None",
"............",
"............",
"............",
"............",
"............",
"............",
"............",
"...######...",
"...######...",
"............",
"............",
"............"};
static const char * const normalize_xpm[] = {
"12 12 2 1",
"# c #000000",
". c None",
"............",
"....######..",
"....######..",
"....#....#..",
"..######.#..",
"..######.#..",
"..#....###..",
"..#....#....",
"..#....#....",
"..######....",
"............",
"............"};
#include "trayicon.h"
#include <qapplication.h>
#include <qpixmap.h>
#include <qpopupmenu.h>
#include <qmainwindow.h>
int main( int argc, char **argv )
{
QApplication app( argc, argv );
QMainWindow mw;
app.setMainWidget( &mw );
QPopupMenu menu;
menu.insertItem( "Show Normal", &mw, SLOT(showNormal()) );
menu.insertSeparator();
menu.insertItem( "&Quit", &app, SLOT(quit()) );
TrayIcon tray( QPixmap( (const char**)normalize_xpm ), "Show window", &menu );
QObject::connect(&tray,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showNormal()));
QPopupMenu menu2;
menu2.insertItem( "Minimize window", &mw, SLOT(showMinimized()) );
TrayIcon tray2( QPixmap( (const char**)minimize_xpm ), "Minimize window", &menu2 );
QObject::connect(&tray2,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showMinimized()));
TrayIcon tray3( QPixmap( (const char**)maximize_xpm ), "Maximize window" );
QObject::connect(&tray3,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showMaximized()));
mw.show();
tray.show();
tray2.show();
tray3.show();
return app.exec();
}